<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>removing user</title>
</head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<script type="text/javascript" language="javascript">

function userList()
{
	$.get('ListUsers',{}, function(responseText)
			{
				$("#Users").replaceWith(responseText);//Working well
			});	
}

function edit(i)
{
	var userId = document.getElementById('userId'+i).value;
	$.get('EditUser', {userId:userId}, function(responseText)
			{
				$("#Users").replaceWith(responseText);
			}
	);
}

function edituser()
{
	var user_edit_Id = document.getElementById('user_edit_Id').value;
	var user_edit_name = document.getElementById('user_edit_name').value;
	var user_edit_access = document.getElementById('user_edit_access').value;

	$.post('EditUser', {user_edit_Id:user_edit_Id, user_edit_name:user_edit_name, user_edit_access:user_edit_access}, function(responseText)
			{
				window.location.href = "UserAccounts.jsp";
			}
	);
}

function slett(i)
{
	var userId = document.getElementById('userId'+i).value;
	var user_slett = 1;
	$.post('EditUser', {userId:userId, user_slett: user_slett}, function(responseText)
			{
				window.location.href = "UserAccounts.jsp";
			}
	);
	user_slett = null;
}

</script>

<body onload="userList()">
<%@ include file="CheckLogin.jsp" %>
<%@ include file="CheckAccesLevel.jsp" %>
	<h1>Users:</h1>
	<div id="Users"></div>
        <div class="loginbutton">
        <input type='button' value='Back' onclick='location.href="UserAccounts.jsp"' style='margin-top: 10px; font-size:16px; width: 100px; height: 30px;'/>
	    </div>
</body>
</html>